package cn.melonlib.apis.support.comp.config.impl;

import cn.melonlib.apis.support.comp.config.ApiRequestConfig;
import cn.melonlib.apis.support.comp.config.ApiRequestUserAgent;
import cn.melonlib.objects.maps.JsonMap;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@ConditionalOnProperty(value = "config",prefix = "apis.request",havingValue = "default",matchIfMissing = true)
public class DefaultApiRequestConfig implements ApiRequestConfig {


    @Resource
    private ApiRequestUserAgent apiRequestUserAgent;

    @Override
    public JsonMap<String> createHeaders() {
        return defaultHeaders().append(USER_AGENT, apiRequestUserAgent.getUserAgent());
    }
}
